//
//  HWQuestionsCollectionViewCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2021/7/9.
//  Copyright © 2021 Chendaobin. All rights reserved.
//

#import "HWQuestionsCollectionViewCell.h"

@interface HWQuestionsCollectionViewCell()
@property(strong,nonatomic) UIImageView *icoimaView;
@property(strong,nonatomic) UILabel *dateLael;
@property(strong,nonatomic) UIView *xiantiaoView;
@property(strong,nonatomic) UILabel *jifenlabel;
@property(strong,nonatomic) UIImageView  *seleimageView;



@end

@implementation HWQuestionsCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame {
    
    if(self = [super initWithFrame:frame]) {
        
        [self setUpUI];
        
    }
    
    return  self;
    
}
// 设置Ui 
- (void)setUpUI {
    
    self.icoimaView  = [[UIImageView alloc]initWithFrame:CGRectMake(0, 10, 35, 35)];
    self.icoimaView.image = [UIImage imageNamed:@"jifenshu"];
    [self addSubview: self.icoimaView];
    
    self.seleimageView =  [[UIImageView alloc]initWithFrame:CGRectMake(12, 0, 9, 5)];
  //   self.seleimageView.image = [UIImage imageNamed:@"sanjiaoxingico"];
    self.seleimageView.image = [UIImage imageNamed:@"xingyaojiantou"];
    [self addSubview:  self.seleimageView];
    
    
    self.jifenlabel  = [[UILabel alloc]initWithFrame:CGRectMake(0,0, 35, 35)];
    self.jifenlabel.text = @"+0.5";
    self.jifenlabel.font = [UIFont systemFontOfSize:12];
    self.jifenlabel.textColor =  RGB(153, 153 , 153);
    //   self.mingchenglabel.backgroundColor = [UIColor redColor];
    self.jifenlabel.textAlignment = NSTextAlignmentCenter;
    [self.icoimaView addSubview:self.jifenlabel];
    
    
    
    self.dateLael  = [[UILabel alloc]initWithFrame:CGRectMake(0,self.icoimaView.bottom+6, 35, 17)];
    self.dateLael.text = @"09.01";
    self.dateLael.font = [UIFont systemFontOfSize:12];
    self.dateLael.textColor =  RGB(51, 51, 51);
    //   self.mingchenglabel.backgroundColor = [UIColor redColor];
    self.dateLael.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.dateLael];
    
    self.xiantiaoView = [[UIView alloc]initWithFrame:CGRectMake(self.dateLael.right,17+10, 28, 2)];
    self.xiantiaoView.backgroundColor = RGB(229, 229, 229);
    [self addSubview:self.xiantiaoView];
    
    
}

-(void)setDataDic:(NSDictionary *)dataDic {
    
    _dataDic = dataDic;
    
    NSString  *answer_status = [NSString stringWithFormat:@"%@",dataDic[@"answer_status"]];
    NSString  *time = [NSString stringWithFormat:@"%@",dataDic[@"time"]];
    NSString  *answer_title = [NSString stringWithFormat:@"%@",dataDic[@"answer_title"]];
    
    if ([answer_status intValue] == 0 ) {
        
      
        self.dateLael.text = time;
        self.jifenlabel.text = answer_title;
      //   self.icoimaView.image = [UIImage imageNamed:@"guokqiico"];
        self.icoimaView.image = [UIImage imageNamed:@"xingyaoweixuanzhong"];
        self.jifenlabel.textColor =  RGB(153, 153 , 153);
        
    } else if ([answer_status intValue] == 1) {
        
        self.dateLael.text = time;
        self.jifenlabel.text =[NSString stringWithFormat:@"+%@",answer_title];
        self.jifenlabel.textColor = [UIColor whiteColor];
        
      //   self.icoimaView.image = [UIImage imageNamed:@"jifenshu"];
       // xingyaoyiwancheng
        
        self.icoimaView.image = [UIImage imageNamed:@"xingyaoyiwancheng"];
        
    } else if ([answer_status intValue] == 2) {
        
        self.dateLael.text = time;
        self.jifenlabel.text = answer_title;
        self.jifenlabel.textColor =  RGB(153, 153 , 153);
       //  self.icoimaView.image = [UIImage imageNamed:@"guokqiico"];
        self.icoimaView.image = [UIImage imageNamed:@"xingyaoweixuanzhong"];
        
    }
    
    
    if ([time isEqualToString:@"今天"]) {
        
        self.seleimageView.hidden = NO;
         
    } else {
        
        self.seleimageView.hidden = YES;
        
        
        
    }
    
    
    
    
    
    
    
    
    
}


@end
